Skip to content

Conversation

dreab8
Copy link
Member

@dreab8 dreab8 commented Sep 16, 2025

Fix #1770

This PR aims to intercept direct access to lazy fields in order to throw a better error message, see ReactiveEnhancementAsProxyLazinessInterceptor and ReactiveLazyAttributeLoadingInterceptor

This PR needs hibernate/hibernate-orm#10950

Copy link
Member

@DavideD DavideD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot,
a couple of things caught my eyes while giving it a very quick pass.

I will have a better look as soon as I finished with all the other non-draft PRs


@Override
public Object getJandexView() {
return delegate.getJandexView();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
BootstrapContext.getJandexView
should be avoided because it has been deprecated.
}

@Override
public LazyAttributeLoadingInterceptor injectInterceptor(

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method ReactiveBytecodeEnhancementMetadataPojoImplAdapter.injectInterceptor(..) could be confused with overloaded method
BytecodeEnhancementMetadataPojoImpl.injectInterceptor
, since dispatch depends on static types.
.withTransaction( session -> session.persist( emily ) )
.chain( () -> getMutinySessionFactory().withSession( session -> {
Crew crew = session.getReference( Crew.class, emily.getId() );
String role = crew.getRole();

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'String role' is never read.
}

public static <U extends Throwable> Uni<U> assertThrown(Class<U> expectedException, Uni<?> uni) {
return uni.onItemOrFailure().transform( (s, e) -> {

Check notice

Code scanning / CodeQL

Useless parameter Note test

The parameter 's' is never used.
if ( obj == null ) {
return 0;
}
return Long.parseLong( (String) obj );

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note test

Potential uncaught 'java.lang.NumberFormatException'.
@dreab8 dreab8 marked this pull request as ready for review October 7, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check error message with lazy loading fields
2 participants